//package com.welike.shibo.controller.admin;
//
//import com.baomidou.mybatisplus.core.metadata.IPage;
//import com.welike.shibo.controller.BaseController;
//import com.welike.shibo.eneity.Admin;
//import com.welike.shibo.eneity.JsonResult;
//import com.welike.shibo.eneity.User;
//import com.welike.shibo.exception.BaseException;
//import com.welike.shibo.service.UserService;
//import com.welike.shibo.service.VideoService;
//import com.welike.shibo.utils.ResultUtils;
//import com.welike.shibo.vo.UserInfoListVO;
//import io.swagger.annotations.ApiParam;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Controller;
//import org.springframework.ui.Model;
//import org.springframework.web.bind.annotation.*;
//import org.springframework.web.servlet.ModelAndView;
//
//import javax.servlet.http.HttpServletRequest;
//import java.text.ParseException;
//
///**
// * @author fangyu
// * @version v1.0.0
// * @since 2019-09-02 18:39
// */
//
//@Slf4j
//@Controller
//@RequestMapping(value = "/admin/user")
//public class AdminUserController extends BaseController {
//
//    @Autowired
//    private UserService userService;
//
//    @Autowired
//    private VideoService videoService;
//
//    @GetMapping(value = {""})
//    public ModelAndView user_list(
//            Model model,
//            @ApiParam(name = "async", value = "异步加载", required = false)
//            @RequestParam(value = "async", required = false) boolean async,
//            @ApiParam(name = "page", value = "页数", required = false)
//            @RequestParam(value = "page", defaultValue = "1", required = false) int page,
//            @ApiParam(name = "limit", value = "每页条数", required = false)
//            @RequestParam(value = "pageSize", defaultValue = "10", required = false)int pageSize
//    ) throws ParseException {
//        log.info("定向用户管理");
//        Admin admin = (Admin) getUser4Session();
//        if (admin == null){
//            return new ModelAndView("admin/login");
//        }
//        IPage<UserInfoListVO> iPage = userService.queryAllUserInfo(page, pageSize);
//        this.addModel(model, iPage, "users");
//        return new ModelAndView(async ? "admin/user_list :: .tab-content" : "admin/user_list");
//    }
//
//    /**
//     * 改变用户状态
//     * @return JsonResult
//     */
//    @PostMapping(value = "/status")
//    @ResponseBody
//    public JsonResult changeVideoStatus(
//            HttpServletRequest request,
//            @RequestParam(name = "id", required = true) Integer id,
//            @RequestParam(name = "status", required = true) Integer status
//    ){
//        log.info("changeUserStatus id:{} ==> status{}", id, status);
//        try {
//            if (null == id) {
//                return ResultUtils.error("审核失败!");
//            }
//            User user = new User();
//            user.setId(id);
//            user.setStatus(status);
//            userService.updateById(user);
//        } catch (BaseException e){
//            e.printStackTrace();
//            log.info(e.getMessage());
//            return ResultUtils.error(e.getMessage());
//        }
//        return ResultUtils.success();
//    }
//
//
//    /**
//     * 删除用户
//     *
//     * @return JsonResult
//     */
//    @PostMapping(value = "/delete")
//    @ResponseBody
//    public JsonResult delVideo(
//            HttpServletRequest request,
//            @RequestParam(name = "id", required = true) Integer id
//    ) {
//        log.info("delUser ==> {}", id);
//        try {
//            if (null == id) {
//                return ResultUtils.error("删除失败!");
//            }
//            userService.removeById(id);
//        } catch (BaseException e) {
//            e.printStackTrace();
//            log.info(e.getMessage());
//            return ResultUtils.error(e.getMessage());
//        }
//        return ResultUtils.success();
//    }
//
//}
